package what.basic.table;
import javax.swing.table.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import what.basic.basiccomponent.*;
public class Jabstracttablemodel {
	Jabstracttablemodel(){
		JFrame f=new Jframe().jframe("",100,100,true);
		Mytable mt=new Mytable();
		JTable t=new JTable(mt);
		JScrollPane sp=new JScrollPane(t);
		f.getContentPane().add(sp,BorderLayout.CENTER);
	}
	public static void main(String[] args) {
		new Jabstracttablemodel();

	}
}
class Mytable extends AbstractTableModel{
	Object[][] st={
			{"wangpeng",new Integer(91),new Integer(100)}
			,{"zhuxuelian",new Integer(82),new Integer(69)},
			{"meiting",new Integer(47),new Integer(57)},
	};
	String[] names={"name","yuwen","shuxue"};
	@Override
	public int getColumnCount() {
		// TODO Auto-generated method stub
		return names.length;
	}
	@Override
	public int getRowCount() {
		// TODO Auto-generated method stub
		return st.length;
	}
	@Override
	public Object getValueAt(int row, int col) {
		// TODO Auto-generated method stub
		return st[row][col];
	}
	public String getColumnName(int col){
		return names[col];
	}
	public Class getColumnClass(int c){
		return getValueAt(0,c).getClass();
	}
}
